<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Command-module for UltraEdit editor &mdash; Dragonfly-modules v0.1 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Dragonfly-modules v0.1 documentation" href="index.html" />
    <link rel="next" title="Command-module to control Windows Explorer" href="mod-_explorer_tools.html" />
    <link rel="prev" title="Command-module for Firefox" href="mod-_firefox.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="mod-_explorer_tools.html" title="Command-module to control Windows Explorer"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mod-_firefox.html" title="Command-module for Firefox"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Dragonfly-modules v0.1 documentation</a> &raquo;</li> 
      </ul>
    </div>  
    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  
  <div class="section" id="command-module-for-ultraedit-editor">
<h1>Command-module for <strong>UltraEdit</strong> editor<a class="headerlink" href="#command-module-for-ultraedit-editor" title="Permalink to this headline">¶</a></h1>
<p>This module offers various commands for <a class="reference external" href="http://www.ultraedit.com/products/ultraedit.html">UltraEdit</a>,
a powerful text and source code editor.</p>
<div class="section" id="module-source-code">
<h2>Module source code<a class="headerlink" href="#module-source-code" title="Permalink to this headline">¶</a></h2>
<p>The most current version of this module can be downloaded from the <a class="reference external" href="http://dragonfly-modules.googlecode.com/svn/trunk/command-modules/uedit32.py">repository here</a>.</p>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><pre>  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129</pre></td><td class="code"><div class="highlight"><pre><span class="c">#</span>
<span class="c"># This file is a command-module for Dragonfly.</span>
<span class="c"># (c) Copyright 2008 by Christo Butcher</span>
<span class="c"># Licensed under the LGPL, see &lt;http://www.gnu.org/licenses/&gt;</span>
<span class="c">#</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Command-module for **UltraEdit** editor</span>
<span class="sd">=======================================</span>

<span class="sd">This module offers various commands for `UltraEdit</span>
<span class="sd">&lt;http://www.ultraedit.com/products/ultraedit.html&gt;`_,</span>
<span class="sd">a powerful text and source code editor.</span>

<span class="sd">&quot;&quot;&quot;</span>


<span class="c">#---------------------------------------------------------------------------</span>

<span class="kn">from</span> <span class="nn">dragonfly</span> <span class="kn">import</span> <span class="p">(</span><span class="n">Grammar</span><span class="p">,</span> <span class="n">AppContext</span><span class="p">,</span> <span class="n">MappingRule</span><span class="p">,</span>
                       <span class="n">Dictation</span><span class="p">,</span> <span class="n">Choice</span><span class="p">,</span> <span class="n">IntegerRef</span><span class="p">,</span> <span class="n">NumberRef</span><span class="p">,</span>
                       <span class="n">Key</span><span class="p">,</span> <span class="n">Text</span><span class="p">,</span> <span class="n">Repeat</span><span class="p">)</span>


<span class="c">#---------------------------------------------------------------------------</span>
<span class="c"># Create the main command rule.</span>

<span class="k">class</span> <span class="nc">CommandRule</span><span class="p">(</span><span class="n">MappingRule</span><span class="p">):</span>

    <span class="n">mapping</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&quot;menu file&quot;</span><span class="p">:</span>                    <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu edit&quot;</span><span class="p">:</span>                    <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-e&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu search&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-s&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu project&quot;</span><span class="p">:</span>                 <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-p&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu view&quot;</span><span class="p">:</span>                    <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-v&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu format&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-t&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu column&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-l&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu macro&quot;</span><span class="p">:</span>                   <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-m&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu scripting&quot;</span><span class="p">:</span>               <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-i&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu advance&quot;</span><span class="p">:</span>                 <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-a&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu window&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-w&quot;</span><span class="p">),</span>
        <span class="s">&quot;menu help&quot;</span><span class="p">:</span>                    <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-h&quot;</span><span class="p">),</span>

        <span class="c"># File menu.</span>
        <span class="s">&quot;new file&quot;</span><span class="p">:</span>                     <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-n&quot;</span><span class="p">),</span>
        <span class="s">&quot;open file&quot;</span><span class="p">:</span>                    <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-o, s-tab&quot;</span><span class="p">),</span>
        <span class="s">&quot;open filename &lt;dict&gt;&quot;</span><span class="p">:</span>         <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-o&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(dict)s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">),</span>
        <span class="s">&quot;close file&quot;</span><span class="p">:</span>                   <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, c&quot;</span><span class="p">),</span>
        <span class="s">&quot;close &lt;1to9&gt; files&quot;</span><span class="p">:</span>           <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, c&quot;</span><span class="p">)</span> <span class="o">*</span> <span class="n">Repeat</span><span class="p">(</span><span class="n">extra</span><span class="o">=</span><span class="s">&quot;1to9&quot;</span><span class="p">),</span>
        <span class="s">&quot;close window &lt;1to9&gt;&quot;</span><span class="p">:</span>          <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-w, </span><span class="si">%(1to9)d</span><span class="s">/20, a-f, c&quot;</span><span class="p">),</span>
        <span class="s">&quot;save file&quot;</span><span class="p">:</span>                    <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-s&quot;</span><span class="p">),</span>
        <span class="s">&quot;save file as&quot;</span><span class="p">:</span>                 <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, a&quot;</span><span class="p">),</span>
        <span class="s">&quot;save backup&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, y&quot;</span><span class="p">),</span>
        <span class="s">&quot;revert to saved&quot;</span><span class="p">:</span>              <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, d&quot;</span><span class="p">),</span>
        <span class="s">&quot;revert to saved force&quot;</span><span class="p">:</span>        <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, d, enter&quot;</span><span class="p">),</span>
        <span class="s">&quot;print file&quot;</span><span class="p">:</span>                   <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-p&quot;</span><span class="p">),</span>
        <span class="s">&quot;page setup&quot;</span><span class="p">:</span>                   <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, g, t&quot;</span><span class="p">),</span>
        <span class="s">&quot;print setup&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, g, u&quot;</span><span class="p">),</span>
        <span class="s">&quot;recent files&quot;</span><span class="p">:</span>                 <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, l&quot;</span><span class="p">),</span>
        <span class="s">&quot;recent projects&quot;</span><span class="p">:</span>              <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, k&quot;</span><span class="p">),</span>
        <span class="s">&quot;recent project &lt;1to9&gt;&quot;</span><span class="p">:</span>        <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-f, k/20, </span><span class="si">%(1to9)d</span><span class="s">&quot;</span><span class="p">),</span>

        <span class="c"># Edit menu.</span>
        <span class="s">&quot;copy file path&quot;</span><span class="p">:</span>               <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-e, f&quot;</span><span class="p">),</span>
        <span class="s">&quot;copy this word&quot;</span><span class="p">:</span>               <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-j, c-c&quot;</span><span class="p">),</span>

        <span class="c"># Search menu.</span>
        <span class="s">&quot;search find&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-f&quot;</span><span class="p">),</span>
        <span class="s">&quot;search find &lt;dict&gt;&quot;</span><span class="p">:</span>           <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-f&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(dict)s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">),</span>
        <span class="s">&quot;search next&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;f3&quot;</span><span class="p">),</span>
        <span class="s">&quot;search replace&quot;</span><span class="p">:</span>               <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-r&quot;</span><span class="p">),</span>
        <span class="s">&quot;search replace &lt;dict&gt; with &lt;dict2&gt;&quot;</span><span class="p">:</span> <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-r&quot;</span><span class="p">)</span> \
                                        <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(dict)s</span><span class="se">\t</span><span class="si">%(dict2)s</span><span class="s">&quot;</span><span class="p">),</span>
        <span class="s">&quot;find in files&quot;</span><span class="p">:</span>                <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-s, i&quot;</span><span class="p">),</span>
        <span class="s">&quot;find this word in files&quot;</span><span class="p">:</span>      <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-j, a-s, i&quot;</span><span class="p">),</span>
        <span class="s">&quot;phi phi this word&quot;</span><span class="p">:</span>            <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-j, a-s, i/20, enter&quot;</span><span class="p">),</span>

        <span class="c"># Format menu.</span>
        <span class="s">&quot;convert tabs to spaces&quot;</span><span class="p">:</span>       <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-t, s&quot;</span><span class="p">),</span>
        <span class="s">&quot;format paragraph&quot;</span><span class="p">:</span>             <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-t&quot;</span><span class="p">),</span>
        <span class="s">&quot;paragraph formatting&quot;</span><span class="p">:</span>         <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-t, f, s&quot;</span><span class="p">),</span>

        <span class="c"># Advanced menu.</span>
        <span class="s">&quot;run command&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-f9&quot;</span><span class="p">),</span>
        <span class="s">&quot;run command in window &lt;1to9&gt;&quot;</span><span class="p">:</span> <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-s, a-w, </span><span class="si">%(1to9)d</span><span class="s">/40, c-f9&quot;</span><span class="p">),</span>
        <span class="s">&quot;run command menu&quot;</span><span class="p">:</span>             <span class="n">Key</span><span class="p">(</span><span class="s">&quot;f9&quot;</span><span class="p">),</span>
        <span class="s">&quot;advanced configuration&quot;</span><span class="p">:</span>       <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-a, c&quot;</span><span class="p">),</span>
        <span class="s">&quot;set tab stop to &lt;1to9&gt; [spaces]&quot;</span><span class="p">:</span> <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-a, c/20, home/20, down:7/10, tab/5:8&quot;</span><span class="p">)</span>
                                         <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(1to9)d</span><span class="se">\t</span><span class="si">%(1to9)d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">),</span>

        <span class="c"># Window menu.</span>
        <span class="s">&quot;window &lt;1to9&gt;&quot;</span><span class="p">:</span>                <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-w, </span><span class="si">%(1to9)d</span><span class="s">&quot;</span><span class="p">),</span>
        <span class="s">&quot;window list&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-w, w&quot;</span><span class="p">),</span>

        <span class="c"># Miscellaneous shortcuts.</span>
        <span class="s">&quot;center cursor&quot;</span><span class="p">:</span>                <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-npmul&quot;</span><span class="p">),</span>
        <span class="s">&quot;cursor to top&quot;</span><span class="p">:</span>                <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-npsub&quot;</span><span class="p">),</span>
        <span class="s">&quot;cursor to bottom&quot;</span><span class="p">:</span>             <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-npadd&quot;</span><span class="p">),</span>
        <span class="s">&quot;[go to] line &lt;int&gt;&quot;</span><span class="p">:</span>           <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-g&quot;</span><span class="p">)</span>
                                         <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(int)d</span><span class="s">&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">Key</span><span class="p">(</span><span class="s">&quot;enter&quot;</span><span class="p">),</span>
        <span class="s">&quot;[mark] lines &lt;int&gt; through &lt;int2&gt;&quot;</span><span class="p">:</span>
                                        <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-g&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(int)d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
                                         <span class="o">+</span> <span class="n">Key</span><span class="p">(</span><span class="s">&quot;c-g&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(int2)d</span><span class="s">&quot;</span><span class="p">)</span>
                                         <span class="o">+</span> <span class="n">Key</span><span class="p">(</span><span class="s">&quot;s-enter&quot;</span><span class="p">),</span>
        <span class="p">}</span>
    <span class="n">extras</span> <span class="o">=</span> <span class="p">[</span>
              <span class="n">Dictation</span><span class="p">(</span><span class="s">&quot;dict&quot;</span><span class="p">),</span>
              <span class="n">Dictation</span><span class="p">(</span><span class="s">&quot;dict2&quot;</span><span class="p">),</span>
              <span class="n">IntegerRef</span><span class="p">(</span><span class="s">&quot;1to9&quot;</span><span class="p">,</span> <span class="mf">1</span><span class="p">,</span> <span class="mf">10</span><span class="p">),</span>
              <span class="n">NumberRef</span><span class="p">(</span><span class="s">&quot;int&quot;</span><span class="p">),</span>
              <span class="n">NumberRef</span><span class="p">(</span><span class="s">&quot;int2&quot;</span><span class="p">),</span>
              <span class="n">Choice</span><span class="p">(</span><span class="s">&quot;zoom&quot;</span><span class="p">,</span>
                    <span class="p">{</span><span class="s">&quot;75&quot;</span><span class="p">:</span> <span class="s">&quot;7&quot;</span><span class="p">,</span> <span class="s">&quot;100&quot;</span><span class="p">:</span> <span class="s">&quot;1&quot;</span><span class="p">,</span> <span class="s">&quot;page width&quot;</span><span class="p">:</span> <span class="s">&quot;p&quot;</span><span class="p">,</span>
                     <span class="s">&quot;text width&quot;</span><span class="p">:</span> <span class="s">&quot;t&quot;</span><span class="p">,</span> <span class="s">&quot;whole page&quot;</span><span class="p">:</span> <span class="s">&quot;w&quot;</span><span class="p">,</span>
                    <span class="p">}),</span>
             <span class="p">]</span>


<span class="c">#---------------------------------------------------------------------------</span>

<span class="n">context</span> <span class="o">=</span> <span class="n">AppContext</span><span class="p">(</span><span class="n">executable</span><span class="o">=</span><span class="s">&quot;uedit32&quot;</span><span class="p">)</span>
<span class="n">grammar</span> <span class="o">=</span> <span class="n">Grammar</span><span class="p">(</span><span class="s">&quot;UltraEdit&quot;</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
<span class="n">grammar</span><span class="o">.</span><span class="n">add_rule</span><span class="p">(</span><span class="n">CommandRule</span><span class="p">())</span>
<span class="n">grammar</span><span class="o">.</span><span class="n">load</span><span class="p">()</span>

<span class="k">def</span> <span class="nf">unload</span><span class="p">():</span>
    <span class="k">global</span> <span class="n">grammar</span>
    <span class="k">if</span> <span class="n">grammar</span><span class="p">:</span> <span class="n">grammar</span><span class="o">.</span><span class="n">unload</span><span class="p">()</span>
    <span class="n">grammar</span> <span class="o">=</span> <span class="bp">None</span>
</pre></div>
</td></tr></table></div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">Command-module for <strong>UltraEdit</strong> editor</a><ul>
<li><a class="reference external" href="#module-source-code">Module source code</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="mod-_firefox.html" title="previous chapter">Command-module for <strong>Firefox</strong></a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="mod-_explorer_tools.html" title="next chapter">Command-module to control <strong>Windows Explorer</strong></a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/mod-uedit32.txt">Show Source</a></li>
            </ul>
          <h3>Quick search</h3>
            <form class="search" action="search.html" method="get">
              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
              <input type="hidden" name="check_keywords" value="yes" />
              <input type="hidden" name="area" value="default" />
            </form>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="mod-_explorer_tools.html" title="Command-module to control Windows Explorer"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mod-_firefox.html" title="Command-module for Firefox"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Dragonfly-modules v0.1 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2008, Christo Butcher.
      Last updated on Apr 10, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
    </div>
  </body>
</html>